<?php
session_start();
require_once 'database.php';

// 获取ID
if (!isset($_GET['id'])) {
    header('Location: teachers.php');
    exit;
}

$teacherId = $_GET['id'];

// 删除
try {
    $stmt = $pdo->prepare('DELETE FROM teachers WHERE id = ?');
    $stmt->execute([$teacherId]);
} catch (PDOException $e) {
    die('删除失败: ' . $e->getMessage());
}

// 重定向回用户管理页面
header('Location: teachers.php');
exit;
